package com.pine.web.pineframework.controller;

import com.pine.common.beans.ResultVo;
import com.pine.common.beans.pineframework.request.DynamicThreadPoolRefreshRequest;
import com.pine.common.systemlog.annotation.SysLog;
import com.pine.manager.pineframework.trigger.SysDynamicThreadPoolTriggerManager;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 系统动态线程池 前端控制器
 * </p>
 *
 * @author pine manage
 * @since 2024-08-29
 */
@Tag(name = "系统动态线程池前端控制器")
@RestController
@RequestMapping("/sys/threadpool")
public class SysDynamicThreadPoolController {

    /**
     * 刷新线程池参数
     *
     * @param request 请求
     * @return 响应
     */
    @PostMapping(value = "/refresh")
    @Operation(summary = "刷新线程池参数")
    @SysLog("刷新线程池参数")
    public ResultVo<Boolean> refresh(@RequestBody @Valid DynamicThreadPoolRefreshRequest request) {
        Boolean triggerResult = SysDynamicThreadPoolTriggerManager.refresh(request);
        return ResultVo.success(triggerResult);
    }
}
